package com.itheima.thread.常用方法.demo3;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
/*
*
*
*/
public class Demo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        //优先级:1-10  默认值:5
        MyCallable mc = new MyCallable();
        FutureTask<String> ft1 = new FutureTask<>(mc);
        Thread t1 = new Thread(ft1);
        t1.setName("飞机");
        t1.setPriority(10);
        t1.start();

        FutureTask<String> ft2 = new FutureTask<>(mc);
        Thread t2 = new Thread(ft2);
        t2.setName("坦克");
        t2.setPriority(1);
        t2.start();
        System.out.println(ft1.get());
        System.out.println(ft2.get());

    }
}
